package com.ysd.twocrm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ysd.twocrm.entity.CourseChildren;
import com.ysd.twocrm.mapper.CourseChildrenMapper;
import com.ysd.twocrm.service.CourseChildrenService;
import com.ysd.twocrm.utils.LayuiUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

@Service
public class CourseChildrenServiceImpl implements CourseChildrenService {
    @Autowired
    private CourseChildrenMapper courseChildrenMapper;
    @Override
    public LayuiUtils<CourseChildren> COURSE_CHILDREN_LAYUI_UTILS(Integer page, List<Integer> cid) {
        QueryWrapper<CourseChildren> courseChildrenQueryWrapper=new QueryWrapper<CourseChildren>();


               courseChildrenQueryWrapper.in("cid",cid);



        LayuiUtils<CourseChildren> courseChildrenLayuiUtils=new LayuiUtils<CourseChildren>();
        Page<CourseChildren> courseChildrenPage=new Page<CourseChildren>(page,10);
        Page<CourseChildren> courseChildrenPage1 = courseChildrenMapper.selectPage(courseChildrenPage, courseChildrenQueryWrapper);
        courseChildrenLayuiUtils.setData(courseChildrenPage1.getRecords());
        courseChildrenLayuiUtils.setCount(courseChildrenPage1.getTotal());
        return courseChildrenLayuiUtils;
    }
}
